

import 'package:flutter/material.dart';
import 'package:vega/repo/api/Api.dart';
import 'package:vega/repo/model/play_detail_model.dart';
import 'package:vega/repo/model/play_source_model.dart';

class PlayViewModel with ChangeNotifier {
  PlayDetialData? detail;
  final List<PlaySourceItem> sources = [];

  getDetail(String url) async {
    Api.instance().playDetail(url).then((value) {
      detail = value;
      notifyListeners();
    });
  }

  getSource(String url) async {
    final sources = await Api.instance().playSource(url);
    if(sources != null) {
      this.sources.addAll(sources);
      notifyListeners();
    }
  }

}